Socket
Socket
Sign inDemoInstall

hoek-boom

Package Overview
Dependencies
2
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    hoek-boom

Extending node utilities shared amongst the extended hapi universe with some boom sprinkles


Version published
Maintainers
1
Created

Readme

Source

hoek-boom Build Status Dependency Status devDependency Status

hoek Logo

boom Logo

+ a few additions

Introduction

This library extends Hoek and exposes Boom.

Additional Features

On top of the already exposed Hoek module API.

assertBoom( condition, message, errorName )

var a = 1, b = 2;

HoekBoom.assertBoom(a === b, 'a should equal b', 'expectationFailed');  // ABORT: a should equal b, throw boom error

// other uses ...
HoekBoom.assertBoom(); // throws Error
HoekBoom.assertBoom(a === b); // throws Error
HoekBoom.assertBoom(a === b, new Error('example')); // throws given error object
HoekBoom.assertBoom(a === b, 'badRequest'); // throws Boom.badRequest()
HoekBoom.assertBoom(a === b, 'some message'); // throws Error('some message')
HoekBoom.assertBoom(a === b, 'some', 'message', new Error('here'), 'for all', {test: 'lolz'});  // throws Error('some message here for all ' + JSON.stringify({test: 'lolz'}))
HoekBoom.assertBoom(a === b, 'some', 'message'); // throws Error('some message')
HoekBoom.assertBoom(a === b, 'check the docs', 'badRequest'); // throws Boom.badRequest('check the docs')
HoekBoom.assertBoom(a === b, 'check the docs', {username: 'johnsmith'}, 'badRequest'); // throws Boom.badRequest('check the docs', {username: 'johnsmith'})
HoekBoom.assertBoom(a === b, 'invalid password', 'sample', {username: 'johnsmith'}, 'unauthorized'); // throws Boom.unauthorized('invalid password', 'sample', {username: 'johnsmith'})

Boom

var Boom = HoekBoom.Boom;

reply(Boom.notFound('stuff wasn\'t found here'));

Keywords

FAQs

Last updated on 30 Nov 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc